#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "--报名分析宽表
DROP TABLE if EXISTS edu_online_dwb.sign_up_wide;
CREATE TABLE edu_online_dwb.sign_up_wide
(
--来自fac_customer_signed的字段
    id                  INT COMMENT '意向ID',
    dt_year             STRING COMMENT '年',
    dt_month            STRING COMMENT '月',
    dt_day              STRING COMMENT '日',
    origin_type         STRING COMMENT '线上线下',
    payment_state       STRING COMMENT '支付状态（报名状态）',
--来自fac_source_channel的字段
    seo_source          STRING COMMENT '来源渠道',
--来自fac_consulting_center的字段
    dept_id             INT COMMENT '咨询中心id',
    dept_name           STRING COMMENT '咨询中心名称',
--来自dim_campus_subject的字段
    itcast_school_id    STRING COMMENT '校区ID',
    itcast_school_name  STRING COMMENT '校区名称',
    itcast_subject_id   STRING COMMENT '学科ID',
    itcast_subject_name STRING COMMENT '学科名称'
)COMMENT '报名主题宽表'
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS TEXTFILE ;

DROP TABLE if EXISTS edu_online_dwb.fac_valid_clue;
CREATE TABLE edu_online_dwb.fac_valid_clue(
     valid_clue_count INT COMMENT '有效线索个数'
)COMMENT '有效线索数表'
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS TEXTFILE ;
	"